﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Collections;
using System.Reflection;

public partial class data_datasync : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        string methodName = Request["method"];
        if (string.IsNullOrEmpty(methodName)) return;
        Type type = this.GetType();
        MethodInfo method = type.GetMethod(methodName);
        method.Invoke(this, null);
    }
    //获取人才网状态正常的企业（不包括已经天正删除的企业）
    public void searchCompanysFromHzhr() {
        string key = Request["key"];
        DataTable datatable = new sql().searchCompanysFromHzhr(key);
        string json = JSON.Encode(datatable);
        Response.Write(json);
    }
    //获取天正雅思状态正常的企业
    public void searchCompanysFromTzys()
    {
        string key = Request["key"];
        DataTable datatable = new sql().searchCompanysFromTzys(key);
        string json = JSON.Encode(datatable);
        Response.Write(json);
    }
    //关联企业
    public void insertCompany()
    {
        String data = Request["data"];
        Hashtable ht = new Hashtable();
        ht = (Hashtable)JSON.Decode(data);
        int res = new sql().insertCompany(ht);
        Response.Write(res);

    }
    //查看已经同步的企业
    public void showSyncCompanys() {
        DataTable dt = new sql().showSyncCompanys();
        String json = JSON.Encode(dt);
        Response.Write(json);
    }
    public void importSingleCompany()
    {
        String data = Request["data"];
        Object json = JSON.Decode(data);
        Hashtable ht = new Hashtable();
        ht = (Hashtable)JSON.Decode(data);
        int res = new sql().importSingleCompany(ht);
        Response.Write(res);
    }
    public void importCompanys() {
        String data = Request["data"];
        ArrayList json = (ArrayList)JSON.Decode(data);
        int res = new sql().importCompanys();
        Response.Write(res);
    }
}